import com.zretc.NoticeApplication;
import com.zretc.api.pojo.Letter;
import com.zretc.common.constant.LetterTemplatesConstant;
import com.zretc.letter.service.LetterService;
import com.zretc.letter.service.WebSocketServer;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

import java.util.Date;

@SpringBootTest(classes = NoticeApplication.class)
public class testWebSocket {
    @Autowired
    private WebSocketServer webSocketServer;
    @Test
    public void testWebSocketOnOpen()
    {
        webSocketServer.sendMessage("6666");
    }
    @Autowired
    private LetterService letterService;
    @Test
    public void testSendLetterToUser()
    {
        Date date=new Date();
        Letter letter=new Letter(null, "asdad", LetterTemplatesConstant.APPROVAL_NOTIFY_TITLE
                ,0,date,false);
        Integer userId=12;
        System.out.println(letterService.publishLetterToSingleUser(letter, userId));
    }
}
